package net.lainiao.morethread.Chapter4.demo9;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * Created by Administrator on 2017/3/3.
 */
public class ResultTask extends FutureTask<String> {
    private String name;
    public ResultTask(Callable<String> callable) {
        super(callable);
        this.name=((ExecutableTask)callable).getName();
    }

    @Override
    protected void done() {
        if(isCancelled()){
            System.out.println(this.name+" Has been canceled ");
        }else{
            System.out.println(this.name+" Has been finished ");
        }
    }
}
